package view.touchability;

import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;
import view.MainGUI;

/**
 *
 * @author Mikkel
 */
public class SkærmNumpad extends javax.swing.JFrame {

    private static SkærmNumpad instance;

    /**
     * Creates new form AktivNumpad
     */
    private SkærmNumpad() {
        initComponents();
        setResizable(false);
        setSize(240, 276);
    }

    public static SkærmNumpad getInstance() {
        if (instance == null) {
            instance = new SkærmNumpad();
        }
       
        return instance;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel3 = new javax.swing.JPanel();
        numPad7 = new javax.swing.JButton();
        numPad8 = new javax.swing.JButton();
        numPad5 = new javax.swing.JButton();
        numPad6 = new javax.swing.JButton();
        numPad4 = new javax.swing.JButton();
        numPad1 = new javax.swing.JButton();
        numPad9 = new javax.swing.JButton();
        numPadOk = new javax.swing.JButton();
        numPad0 = new javax.swing.JButton();
        numPad3 = new javax.swing.JButton();
        numPadSlet = new javax.swing.JButton();
        numPad2 = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();

        setAlwaysOnTop(true);
        setBackground(new java.awt.Color(255, 255, 51));
        setFocusableWindowState(false);
        setUndecorated(true);
        getContentPane().setLayout(null);

        jPanel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 2));
        jPanel3.setOpaque(false);
        jPanel3.setLayout(null);

        numPad7.setBackground(MainGUI.BUTTON_STANDARD_COLOR);
        numPad7.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        numPad7.setText("7");
        numPad7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                numPad7ActionPerformed(evt);
            }
        });
        jPanel3.add(numPad7);
        numPad7.setBounds(10, 142, 66, 59);

        numPad8.setBackground(MainGUI.BUTTON_STANDARD_COLOR);
        numPad8.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        numPad8.setText("8");
        numPad8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                numPad8ActionPerformed(evt);
            }
        });
        jPanel3.add(numPad8);
        numPad8.setBounds(85, 142, 66, 59);

        numPad5.setBackground(MainGUI.BUTTON_STANDARD_COLOR);
        numPad5.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        numPad5.setText("5");
        numPad5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                numPad5ActionPerformed(evt);
            }
        });
        jPanel3.add(numPad5);
        numPad5.setBounds(85, 76, 66, 59);

        numPad6.setBackground(MainGUI.BUTTON_STANDARD_COLOR);
        numPad6.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        numPad6.setText("6");
        numPad6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                numPad6ActionPerformed(evt);
            }
        });
        jPanel3.add(numPad6);
        numPad6.setBounds(162, 76, 66, 59);

        numPad4.setBackground(MainGUI.BUTTON_STANDARD_COLOR);
        numPad4.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        numPad4.setText("4");
        numPad4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                numPad4ActionPerformed(evt);
            }
        });
        jPanel3.add(numPad4);
        numPad4.setBounds(10, 76, 66, 59);

        numPad1.setBackground(MainGUI.BUTTON_STANDARD_COLOR);
        numPad1.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        numPad1.setText("1");
        numPad1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                numPad1ActionPerformed(evt);
            }
        });
        jPanel3.add(numPad1);
        numPad1.setBounds(10, 10, 66, 59);

        numPad9.setBackground(MainGUI.BUTTON_STANDARD_COLOR);
        numPad9.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        numPad9.setText("9");
        numPad9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                numPad9ActionPerformed(evt);
            }
        });
        jPanel3.add(numPad9);
        numPad9.setBounds(162, 142, 66, 59);

        numPadOk.setBackground(MainGUI.BUTTON_STANDARD_COLOR);
        numPadOk.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        numPadOk.setText("OK");
        numPadOk.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                numPadOkActionPerformed(evt);
            }
        });
        jPanel3.add(numPadOk);
        numPadOk.setBounds(162, 208, 66, 59);

        numPad0.setBackground(MainGUI.BUTTON_STANDARD_COLOR);
        numPad0.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        numPad0.setText("0");
        numPad0.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                numPad0ActionPerformed(evt);
            }
        });
        jPanel3.add(numPad0);
        numPad0.setBounds(85, 208, 66, 59);

        numPad3.setBackground(MainGUI.BUTTON_STANDARD_COLOR);
        numPad3.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        numPad3.setText("3");
        numPad3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                numPad3ActionPerformed(evt);
            }
        });
        jPanel3.add(numPad3);
        numPad3.setBounds(162, 10, 66, 59);

        numPadSlet.setBackground(MainGUI.BUTTON_STANDARD_COLOR);
        numPadSlet.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        numPadSlet.setText("Slet");
        numPadSlet.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                numPadSletActionPerformed(evt);
            }
        });
        jPanel3.add(numPadSlet);
        numPadSlet.setBounds(10, 208, 66, 59);

        numPad2.setBackground(MainGUI.BUTTON_STANDARD_COLOR);
        numPad2.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
        numPad2.setText("2");
        numPad2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                numPad2ActionPerformed(evt);
            }
        });
        jPanel3.add(numPad2);
        numPad2.setBounds(85, 10, 66, 59);

        getContentPane().add(jPanel3);
        jPanel3.setBounds(0, 0, 240, 276);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/skærmNumpadBaggrun.PNG"))); // NOI18N
        getContentPane().add(jLabel1);
        jLabel1.setBounds(0, 0, 240, 276);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void numPad7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numPad7ActionPerformed
        try {
            Robot robot = new Robot();
            robot.keyPress(KeyEvent.VK_7);
            robot.keyRelease(KeyEvent.VK_7);
        } catch (AWTException ex) {
            System.out.println("Fejl: " + ex.getLocalizedMessage());
        }
    }//GEN-LAST:event_numPad7ActionPerformed

    private void numPad8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numPad8ActionPerformed
        try {
            Robot robot = new Robot();
            robot.keyPress(KeyEvent.VK_8);
            robot.keyRelease(KeyEvent.VK_8);
        } catch (AWTException ex) {
            System.out.println("Fejl: " + ex.getLocalizedMessage());
        }
    }//GEN-LAST:event_numPad8ActionPerformed

    private void numPad6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numPad6ActionPerformed
        try {
            Robot robot = new Robot();
            robot.keyPress(KeyEvent.VK_6);
            robot.keyRelease(KeyEvent.VK_6);
        } catch (AWTException ex) {
            System.out.println("Fejl: " + ex.getLocalizedMessage());
        }
    }//GEN-LAST:event_numPad6ActionPerformed

    private void numPad4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numPad4ActionPerformed
        try {
            Robot robot = new Robot();
            robot.keyPress(KeyEvent.VK_4);
            robot.keyRelease(KeyEvent.VK_4);
        } catch (AWTException ex) {
            System.out.println("Fejl: " + ex.getLocalizedMessage());
        }
    }//GEN-LAST:event_numPad4ActionPerformed

    private void numPad1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numPad1ActionPerformed
        try {
            Robot robot = new Robot();
            robot.keyPress(KeyEvent.VK_1);
            robot.keyRelease(KeyEvent.VK_1);
        } catch (AWTException ex) {
            System.out.println("Fejl: " + ex.getLocalizedMessage());
        }
    }//GEN-LAST:event_numPad1ActionPerformed

    private void numPad9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numPad9ActionPerformed
        try {
            Robot robot = new Robot();
            robot.keyPress(KeyEvent.VK_9);
            robot.keyRelease(KeyEvent.VK_9);
        } catch (AWTException ex) {
            System.out.println("Fejl: " + ex.getLocalizedMessage());
        }
    }//GEN-LAST:event_numPad9ActionPerformed

    private void numPadOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numPadOkActionPerformed
        try {
            Robot robot = new Robot();
            robot.keyPress(KeyEvent.VK_ENTER);
            robot.keyRelease(KeyEvent.VK_ENTER);
        } catch (AWTException ex) {
            System.out.println("Fejl: " + ex.getLocalizedMessage());
        }
    }//GEN-LAST:event_numPadOkActionPerformed

    private void numPad0ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numPad0ActionPerformed
        try {
            Robot robot = new Robot();
            robot.keyPress(KeyEvent.VK_0);
            robot.keyRelease(KeyEvent.VK_0);
        } catch (AWTException ex) {
            System.out.println("Fejl: " + ex.getLocalizedMessage());
        }
    }//GEN-LAST:event_numPad0ActionPerformed

    private void numPad3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numPad3ActionPerformed
        try {
            Robot robot = new Robot();
            robot.keyPress(KeyEvent.VK_3);
            robot.keyRelease(KeyEvent.VK_3);
        } catch (AWTException ex) {
            System.out.println("Fejl: " + ex.getLocalizedMessage());
        }
    }//GEN-LAST:event_numPad3ActionPerformed

    private void numPadSletActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numPadSletActionPerformed
        try {
            Robot robot = new Robot();
            robot.keyPress(KeyEvent.VK_BACK_SPACE);
            robot.keyRelease(KeyEvent.VK_BACK_SPACE);
        } catch (AWTException ex) {
            System.out.println("Fejl: " + ex.getLocalizedMessage());
        }
    }//GEN-LAST:event_numPadSletActionPerformed

    private void numPad2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numPad2ActionPerformed
        try {
            Robot robot = new Robot();
            robot.keyPress(KeyEvent.VK_2);
            robot.keyRelease(KeyEvent.VK_2);
        } catch (AWTException ex) {
            System.out.println("Fejl: " + ex.getLocalizedMessage());
        }
    }//GEN-LAST:event_numPad2ActionPerformed

    private void numPad5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_numPad5ActionPerformed
        try {
            Robot robot = new Robot();
            robot.keyPress(KeyEvent.VK_5);
            robot.keyRelease(KeyEvent.VK_5);
        } catch (AWTException ex) {
            System.out.println("Fejl: " + ex.getLocalizedMessage());
        }
    }//GEN-LAST:event_numPad5ActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JButton numPad0;
    private javax.swing.JButton numPad1;
    private javax.swing.JButton numPad2;
    private javax.swing.JButton numPad3;
    private javax.swing.JButton numPad4;
    private javax.swing.JButton numPad5;
    private javax.swing.JButton numPad6;
    private javax.swing.JButton numPad7;
    private javax.swing.JButton numPad8;
    private javax.swing.JButton numPad9;
    private javax.swing.JButton numPadOk;
    private javax.swing.JButton numPadSlet;
    // End of variables declaration//GEN-END:variables
}
